<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

use think\Route;
Route::get('index',         'index/Index/index');
Route::get('blog/:uid/:cid/:tid', 'index/Index/blog',
    [
        'param_depr'    =>  '_',
        'ext'=>'html'
    ],
    [
        'uid'   =>  '\d+',
        'cid'   =>  '\d+',
        'tid'   =>  '\d+'
    ]
);              // 博客列表
Route::get('article/:id',   'index/Index/article', ['id' => '\d+']);
Route::get('comment/:id',   'index/Index/comment', ['id' => '\d+']);

Route::group('admin', function(){
    // 分类
    Route::group('category', [
        'index'         =>  ['back/Category/index',       ['method' => 'get']  ],
        'add'           =>  ['back/Category/add',         ['method' => 'get']  ],
        'add_process'   =>  ['back/Category/addProcess',  ['method' => 'post'] ],
        'edit/:id'      =>  ['back/Category/edit',        ['method' => 'get'], ['id' => '\d+']],
        'edit_process'  =>  ['back/Category/editProcess', ['method' => 'post'] ],
        'delete'        =>  ['back/Category/delete',      ['method' => 'post'] ],
    ]);
    // 标签
    Route::group('tag', [
        'index'         =>  ['back/Tag/index',       ['method' => 'get']  ],
        'add'           =>  ['back/Tag/add',         ['method' => 'get']  ],
        'add_process'   =>  ['back/Tag/addProcess',  ['method' => 'post'] ],
        'edit/:id'      =>  ['back/Tag/edit',        ['method' => 'get'], ['id' => '\d+']],
        'edit_process'  =>  ['back/Tag/editProcess', ['method' => 'post'] ],
        'delete'        =>  ['back/Tag/delete',      ['method' => 'post'] ],
    ]);
    // 菜单
    Route::group('menu', [
        'index'         =>  ['back/Menu/index',       ['method' => 'get']  ],
        'add'           =>  ['back/Menu/add',         ['method' => 'get']  ],
        'add_process'   =>  ['back/Menu/addProcess',  ['method' => 'post'] ],
        'edit/:id'   =>  ['back/Menu/edit',        ['method' => 'get'], ['id' => '\d+']],
        'edit_process'  =>  ['back/Menu/editProcess', ['method' => 'post'] ],
        'change_show'   =>  ['back/Menu/changeShow',  ['method' => 'post'] ],
        'delete'        =>  ['back/Menu/delete',      ['method' => 'post'] ],
    ]);
    // 用户
    Route::group('user', [
        'index'         =>  ['back/User/index',       ['method' => 'get']  ],
        'add'           =>  ['back/User/add',         ['method' => 'get']  ],
        'add_process'   =>  ['back/User/addProcess',  ['method' => 'post'] ],
        'edit/:id'      =>  ['back/User/edit',        ['method' => 'get'], ['id' => '\d+']],
        'edit_process'  =>  ['back/User/editProcess', ['method' => 'post'] ],
        'delete'        =>  ['back/User/delete',      ['method' => 'post'] ],
        'login'         =>  ['back/User/login',       ['method' => 'get'] ],
        'login_process' =>  ['back/User/loginProcess',['method' => 'post'] ],
        'logout'        =>  ['back/User/logout',      ['method' => 'post'] ],
        'change_image'  =>  ['back/User/changeImage', ['method' => 'post'] ],
    ]);
    // 文章
    Route::group('article', [
        'index'         =>  ['back/Article/index',          ['method' => 'get']  ],
        'add'           =>  ['back/Article/add',            ['method' => 'get']  ],
        'add_process'   =>  ['back/Article/addProcess',     ['method' => 'post'] ],
        'markdown_image'=>  ['back/Article/markdownImage',  ['method' => 'post'] ],
        'edit/:id'      =>  ['back/Article/edit',           ['method' => 'get'], ['id' => '\d+']],
        'edit_process'  =>  ['back/Article/editProcess',    ['method' => 'post'] ],
        'change_status' =>  ['back/Article/changeStatus',   ['method' => 'post'] ],
        'delete'        =>  ['back/Article/delete',         ['method' => 'post'] ],
        'change_image'  =>  ['back/Article/changeImage',    ['method' => 'post'] ],
    ]);
    // 角色
    Route::group('role', [
        'index'         =>  ['back/Role/index',       ['method' => 'get']  ],
        'add'           =>  ['back/Role/add',         ['method' => 'get']  ],
        'add_process'   =>  ['back/Role/addProcess',  ['method' => 'post'] ],
        'edit/:id'      =>  ['back/Role/edit',        ['method' => 'get'], ['id' => '\d+'] ],
        'edit_process'  =>  ['back/Role/editProcess', ['method' => 'post'] ],
        'delete'        =>  ['back/Role/delete',      ['method' => 'post'] ],
        'auth/:id'      =>  ['back/Role/auth',        ['method' => 'get'], ['id' => '\d+'] ],
        'authProcess'   =>  ['back/Role/authProcess', ['method' => 'post'] ],
    ]);
    // 节点
    Route::group('node', [
        'index'         =>  ['back/Node/index',       ['method' => 'get']  ],
        'add'           =>  ['back/Node/add',         ['method' => 'get']  ],
        'add_process'   =>  ['back/Node/addProcess',  ['method' => 'post'] ],
        'edit/:id'      =>  ['back/Node/edit',        ['method' => 'get'], ['id' => '\d+']],
        'edit_process'  =>  ['back/Node/editProcess', ['method' => 'post'] ],
        'delete'        =>  ['back/Node/delete',      ['method' => 'post'] ],
    ]);
    // 系统
    Route::group('system', [
        'dashboard'     =>  ['back/System/dashboard',  ['method' => 'get'] ],
        'test'          =>  ['back/System/test',       ['method' => 'get'] ],
        'uptoken'       =>  ['back/System/upToken',    ['method' => 'get'] ],
        'callback'      =>  ['back/System/callback',   ['method' => 'post'] ],
        'upload'        =>  ['back/System/upload',     ['method' => 'get'] ],
        'image'         =>  ['back/System/image',      ['method' => 'get'] ],
    ]);
    // 评论
    Route::group('comment', [
        'add_process'       =>  ['back/Comment/addProcess',  ['method' => 'post'] ],
        'reply/:id'         =>  ['back/Comment/reply',       ['method' => 'get'], ['id' => '\d+'] ],
        'comment/:id'       =>  ['back/Comment/comment',     ['method' => 'get'], ['id' => '\d+'] ],
    ]);
    // 图片
    Route::group('image', [
        'upload/:table/:tid/:pid/'  =>  ['back/Image/upload',           ['method' => 'get'], ['pid' => '\d+', 'tid'=>'\d+'] ],
        'upload_process'            =>  ['back/Image/uploadProcess',    ['method' => 'post'] ],
        'mkdir'                     =>  ['back/Image/mkdir',            ['method' => 'post'] ],
        'delete'                    =>  ['back/Image/delete',           ['method' => 'post'] ],
        'rename'                    =>  ['back/Image/rename',           ['method' => 'post'] ],
    ]);


},['ext'=>'html']);
